"""
场景1、上传文件的元素是是input标签 ：<input type="file" id="fu" value="选择文件">
这种比较方便，直接send_keys这个文件的路径就可以了。

from selenium import webdriver
from selenium.webdriver.common.by import By
from time import sleep

driver = webdriver.Chrome()
driver.maximize_window()
driver.get('https://www.baidu.com/')

# 点击相机的按钮
driver.find_element(By.XPATH,'//span[@class="soutu-btn"]').click()

# 找到文件上传的元素 直接进行send_keys()操作 把上传的文件的路径 填进去
driver.find_element(By.XPATH,'//input[@class="upload-pic"]').send_keys(r'C:\Users\libin\Desktop\tricy.png')
sleep(3)
"""
# 练习
from selenium import webdriver
from selenium.webdriver.common.by import By
from time import sleep

driver = webdriver.Chrome()
driver.maximize_window()
driver.get('https://www.baidu.com/')
driver.find_element(By.XPATH, "//span[@class='soutu-btn']").click()
sleep(3)
driver.find_element(By.XPATH,'//input[@class="upload-pic"]').send_keys(r'C:\Users\Administrator\Desktop\test')
# SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 1149-1150: truncated \UXXXXXXXX escape
sleep(3)

# 路径处理为何会报错？？